﻿using System;
using Framework.Dependency;
using Framework.Validators.Session;
using Interfaces.Validation.Services;
using Microsoft.Practices.EnterpriseLibrary.Validation;
using Microsoft.Practices.EnterpriseLibrary.Validation.Validators;
using Microsoft.Practices.Unity;

namespace BusinessLogic.Models.ValidationAttributes
{
    [AttributeUsage(AttributeTargets.Class)]
    public class SessionExpiredValidationAttribute : ValidatorAttribute
    {
        public string Message { get; set; }

        protected override Validator DoCreateValidator(Type targetType)
        {
            return new SessionExpiredValidator(Message, Tag, 
                DependencyManager.Container.Resolve<ISessionValidationService>());
        }
    }
}
